package cn.wei.youvie.service;

import cn.wei.youvie.domain.dto.user.UserAddRequest;
import cn.wei.youvie.domain.dto.user.UserQueryRequest;
import cn.wei.youvie.domain.entity.User;
import cn.wei.youvie.domain.vo.LoginUserVO;
import cn.wei.youvie.domain.vo.UserVO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* @author Youvie
* @description 针对表【user(用户)】的数据库操作Service
* @createDate 2024-08-24 16:33:08
*/
public interface UserService extends IService<User> {
    //登录
    LoginUserVO userLogin(String userAccount, String userPassword, HttpServletRequest request);

    //注册
    Long register(String account, String password, String name);

    //User 转换 LoginUserVO
    LoginUserVO getLoginUserVO(User user, HttpServletRequest request);

    //添加用户
    long addUser(UserAddRequest userAddRequest);

    //用户主动下线
    boolean userLogout(HttpServletRequest request);

    //User 转换 UserVO
    UserVO getUserVO(User user);

    //集合版 User 转换 UserVO
    List<UserVO> getUserVO(List<User> userList);

    //根据参数查询 User
    QueryWrapper<User> getQueryWrapper(UserQueryRequest userQueryRequest);

    //获取当前登录用户
    User getLoginUser(HttpServletRequest request);

    //分页查询 UserVO
    Page<UserVO> listUserVOByPage(UserQueryRequest userQueryRequest);

    //分页查询 User
    Page<User> listUserByPage(UserQueryRequest userQueryRequest);

    //是否管理员
    boolean isAdmin(HttpServletRequest request);

    boolean isAdmin(User user);
}